package com.salon.modules.makeup.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.salon.common.http.response.PageResult;
import com.salon.modules.makeup.mapper.ServiceMapper;
import com.salon.modules.makeup.entity.ServiceEntity;
import com.salon.modules.makeup.service.ServiceService;
import com.salon.common.utils.Query;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

import java.util.Map;

/**
 * 美容服务
 *
 * @author lch 12345678@qq.com
 * @since 1.0.0 2023-10-09
 */
@Service
public class ServiceServiceImpl extends ServiceImpl<ServiceMapper, ServiceEntity> implements ServiceService {

    @Override
    public PageResult<ServiceEntity> listServiceByPage(Map<String, Object> params) {
        IPage<ServiceEntity> page = new Query<ServiceEntity>().getPage(params);
        IPage<ServiceEntity> list = baseMapper.listServiceByPage(page, params);
        return new PageResult<>(list.getTotal(), list.getCurrent(), list.getSize(), list.getRecords());
    }

    @Override
    public PageResult<ServiceEntity> serviceListPage(Map<String, Object> params) {
        IPage<ServiceEntity> page = new Query<ServiceEntity>().getPage(params);
        IPage<ServiceEntity> list = baseMapper.listServiceByPage(page, params);
        return new PageResult<>(list.getTotal(), list.getCurrent(), list.getSize(), list.getRecords());
    }

}